import request from '@/utils/request';

/**
 * 充值列表
 */
export async function rechargeOrderList(data) {
  const res = await request.post('/order/rechargeOrderList', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
// 套餐卡折扣
export async function gooodsdiscount(data) {
  const res = await request.post('/goods/gooodsdiscount', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
// 优惠券
export async function userCouponList(data) {
  const res = await request.post('/coupon/userCouponList', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
// 领取优惠卷列表
export async function couponList(data) {
  const res = await request.post('/coupon/userAuthorityCoupon', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
// 领取优惠券

export async function receiveCoupon(data) {
  const res = await request.post('/coupon/receiveCoupon', data);
  if (res.data.code === 0) {
    return res.data;
  } else {
    return res.data;
  }
  // return Promise.reject(new Error(res.data.msg));1
}
